#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	while (n--)
	{
		int m, n;
		cin >> m >> n;
		if (m < n) {
			int temp = m;
			m = n;
			n = temp;
		}
		if (m % n == 0) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
}